package com.chainyoung.component_tmperson.ui.mvp.presenter;

import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.entity.InviteFriend;
import com.chainyoung.component_tmperson.ui.mvp.contract.InviteFriendContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.UpdatePwdContract;

import java.util.TreeMap;

import javax.inject.Inject;

@ActivityScope
public class InviteFriendPresenter extends BasePresenter<InviteFriendContract.Model, InviteFriendContract.View> {

    @Inject
    public InviteFriendPresenter(InviteFriendContract.Model model, InviteFriendContract.View rootView) {
        super(model, rootView);
    }


    public void getInviteFriend(TreeMap<String, Object> map) {
        addSubscribe(mModel.getInviteFriend(map)
                .compose(RxUtils.<InviteFriend>rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<InviteFriend>(mView) {
                    @Override
                    public void onNext(InviteFriend object) {
                        mView.onGetInviteFriendSucces(object);
                    }

                    @Override
                    public void onError(Throwable e) {
                        super.onError(e);
                    }
                }));
    }


}

